package com.nc.delivery_project.server.domain;

import java.util.List;

/**
 * Created by miroshnik on 01.12.14.
 */
public class Role {

    private int id;

    private String title;

    public Role(int id, String title) {
        this(id);
        this.title = title;
    }

    public Role(int id) {
        this.id = id;
    }

    public Role() {}

    public Role(String title) {
        this.title = title;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Role)) return false;

        Role role = (Role) o;

        if (title != null ? !title.equals(role.title) : role.title != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = title != null ? title.hashCode() : 0;
        result = 31 * result;
        return result;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Role{");
        sb.append("id=").append(id);
        sb.append(", title='").append(title).append('\'');
        sb.append('}');
        return sb.toString();
    }
}
